package com.example.baselibrary.db.table;

import android.text.TextUtils;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

/**
 * 联系人维护表
 *
 * @author: NPF
 * @date: 2018/3/30.
 */
@DatabaseTable(tableName = "accountInfo")
public class AccountTable {
    @DatabaseField(columnName = "account", id = true)
    public String account;
    @DatabaseField(columnName = "nick")
    public String nick;
    @DatabaseField(columnName = "avatar")
    public String avatar;
    /**
     * 企业用户id
     */
    @DatabaseField(columnName = "memberId")
    public String memberId;
    /**
     * 职位
     */
    @DatabaseField(columnName = "position")
    public String position;

    public AccountTable() {
    }

    public AccountTable(String account, String nick, String avatar, String memberId, String position) {
        this.account = TextUtils.isEmpty(account) ? "" : account;
        this.nick = TextUtils.isEmpty(nick) ? "" : nick;
        this.avatar = TextUtils.isEmpty(avatar) ? "" : avatar;
        this.memberId = TextUtils.isEmpty(memberId) ? "" : memberId;
        this.position = TextUtils.isEmpty(position) ? "" : position;
    }

    public AccountTable(String account, String nick, String avatar) {
        this.account = TextUtils.isEmpty(account) ? "" : account;
        this.nick = TextUtils.isEmpty(nick) ? "" : nick;
        this.avatar = TextUtils.isEmpty(avatar) ? "" : avatar;
        this.memberId = "";
        this.position = "";
    }


    public boolean isEmpty() {
        return TextUtils.isEmpty(account) || TextUtils.isEmpty(nick);
    }

    @Override
    public String toString() {
        return "AccountTable{" +
                "account='" + account + '\'' +
                ", nick='" + nick + '\'' +
                ", avatar='" + avatar + '\'' +
                ", memberId='" + memberId + '\'' +
                ", position='" + position + '\'' +
                '}';
    }
}
